<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>会员登录</title>
		<link rel="stylesheet" type="text/css" href="./css/login.css">
        <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.0/jquery.js"></script>
        <script type="text/javascript">


            $(function () {
                //获取数据传到后台，再接收返回值 正确就带数据转到index
                const REGISTER_URL = "http://localhost:8080/mi/login"

                $("#sub").click(function () {
                    let username = $("#name").val();
                    let password = $("#password").val();
                    let params = {
                        username: username,
                        password: password
                    };

                    $.post(REGISTER_URL, params, function (result) {
                        if (result.status === 200) {
                            //页面跳转
                            localStorage.setItem("name",username);
                            location.href = "index.html";
                        } else {
                            alert("密码错误或者账号错误");
                        }
                    })

                })
            })
        </script>
	</head>
	<body>
		<!-- login -->
		<div class="top center">
			<div class="logo center">
				<a href="./index.html" target="_blank"><img src="./image/mistore_logo.png" alt=""></a>
			</div>
		</div>
		<form   action="#" class="form center">
		<div class="login">
			<div class="login_center">
				<div class="login_top">
					<div class="left fl">会员登录</div>
					<div class="right fr">您还不是我们的会员？<a href="./register.html" target="_self">立即注册</a></div>
					<div class="clear"></div>
					<div class="xian center"></div>
				</div>
				<div class="login_main center">
					<div class="username">用户名:&nbsp;<input class="shurukuang" type="text" id="name" name="username" placeholder="请输入你的用户名"/></div>
					<div class="username">密&nbsp;&nbsp;&nbsp;&nbsp;码:&nbsp;<input class="shurukuang" type="password" id="password" name="password" placeholder="请输入你的密码"/></div>
<!--					<div class="username">-->
<!--						<div class="left fl">验证码:&nbsp;<input class="yanzhengma" type="text" name="username" placeholder="请输入验证码"/></div>-->
<!--						<div class="right fl"><img src="./image/yanzhengma.jpg"></div>-->
<!--						<div class="clear"></div>-->
<!--					</div>-->
				</div>
				<div class="login_submit">
					<input class="submit" type="button" name="submit" id="sub" value="立即登录" >
				</div>
				
			</div>
		</div>
		</form>
		<footer>
			<div class="copyright">简体 | 繁体 | English | 常见问题</div>
			<div class="copyright">小米公司版权所有-京ICP备10046444-<img src="./image/ghs.png" alt="">京公网安备11010802020134号-京ICP证110507号</div>

		</footer>
	</body>
</html>